package com.yanqu.road.entity.activity.goldingotfund.data;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;
import org.apache.mina.util.ConcurrentHashSet;

import java.util.Set;

@FieldTypeAnnotation(tableName = "t_u_activity_gold_ingot_fund_user_data")
public class GoldIngotFundUserData extends DataObject {

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;

    @FieldTypeAnnotation(desc = "玩家ID", select = true, update = true)
    private long userId;

    @FieldTypeAnnotation(desc = "签到的天")
    private Set<Integer> signDays = new ConcurrentHashSet<>();

    @FieldTypeAnnotation(desc = "已购买的基金mallId")
    private Set<Integer> buyMallKeyIds = new ConcurrentHashSet<>();

    public int getActivityId() {
        return activityId;
    }
    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public long getUserId() {
        return userId;
    }
    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public Set<Integer> getBuyMallKeyIds() {
        return buyMallKeyIds;
    }
    public void setBuyMallKeyIds(Set<Integer> buyMallKeyIds) {
        if (null == buyMallKeyIds){
            return;
        }
        if (this.buyMallKeyIds == null || !this.buyMallKeyIds.equals(buyMallKeyIds)) {
            this.buyMallKeyIds = buyMallKeyIds;
            setOp(DataStatus.Update);
        }
    }

    public void addBuyMallKeyId(int keyId){
        buyMallKeyIds.add(keyId);
        setOp(DataStatus.Update);
    }

    public Set<Integer> getSignDays() {
        return signDays;
    }

    public void setSignDays(Set<Integer> signDays) {
        if (null == signDays){
            return;
        }
        if (this.signDays == null || !this.signDays.equals(signDays)) {
            this.signDays = signDays;
            setOp(DataStatus.Update);
        }
    }

    public void addSignDay(int day){
        signDays.add(day);
        setOp(DataStatus.Update);
    }
}
